<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script src="jquery-3.1.1.js"></script>
</head>

<body>
    <textarea rows="10" cols="30" onkeyup="getByteLen(this)"></textarea>
    <p>已经输入了<span>0</span>个字</p>
</body>

</html>
<script>
    $(function () {
        $('textarea').keyup(function () {
            var zishu = $('textarea').val().length;
            // console.log(zishu)
            $('span').text(zishu)
        })
    })

</script>